From 14bd22a50d0562d6da7d86ff5e24b9a74b16eb80 Mon Sep 17 00:00:00 2001 From: Vladimir Petko Date: Wed, 22 Jul 2026 12:23:02 +1200 Subject: [PATCH] disable UnsafeGuard in Unsafe_SetMemory0 for i386 Bug: https://bugs.openjdk.org/browse/JDK-8335238 Forwarded: not-needed Last-Update: 2024-07-01 x86 hotspot aseembler incorrectly returns next instruction's PC for rep stos %eax,%es:(%edi) causing an infinite loop. This patch removes UnsafeGuard for i386, so that VM crashes instead of hanging indefinitely. Patch should not be forwarded as it reverses JDK-8320886 for i386. Gbp-Pq: Name jdk-8335238-workaround.patch --- src/hotspot/share/prims/unsafe.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/hotspot/share/prims/unsafe.cpp b/src/hotspot/share/prims/unsafe.cpp index a6300e814..d173b3fa7 100644 --- a/src/hotspot/share/prims/unsafe.cpp +++ b/src/hotspot/share/prims/unsafe.cpp @@ -391,7 +391,9 @@ UNSAFE_ENTRY_SCOPED(void, Unsafe_SetMemory0(JNIEnv *env, jobject unsafe, jobject void* p = index_oop_from_field_offset_long(base, offset); { +#if !defined(IA32) || !defined(TARGET_ARCH_x86) GuardUnsafeAccess guard(thread); +#endif if (StubRoutines::unsafe_setmemory() != nullptr) { MACOS_AARCH64_ONLY(ThreadWXEnable wx(WXExec, thread)); StubRoutines::UnsafeSetMemory_stub()(p, sz, value); -- 2.39.5